﻿namespace Genesis.Infrastructure.Application.Specifications
{

    public class OrSpecification<T> : Specification<T>
    {

        private ISpecification<T> primary;

        private ISpecification<T> secondary;

        public OrSpecification(ISpecification<T> primary, ISpecification<T> secondary)
        {

            this.primary = primary;

            this.secondary = secondary;

        }

        public override bool IsSatisfiedBy(T candidate)
        {

            return primary.IsSatisfiedBy(candidate) || secondary.IsSatisfiedBy(candidate);

        }

    }

}